home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / blitz / cca-source.lha / cca-src / TXT-SOURCE / league.bbh.txt < prev    next >
Text File  |  1998-12-13  |  3KB  |  101 lines

  1. ;;;;high score setup
  2.  
  3.  
  4.  
  5. ;******************************************************************************************************************************
  6. ;******************************************************************************************************************************
  7. Statement _strtoarr{*src, *dest}
  8.  
  9.     b.w = 19
  10.  
  11.     For a.w = 0 To 18
  12.         Poke.b (*dest + a),Peek.b(*src + a)
  13.         If Peek.b(*dest +a) = 0 ; if null then end string
  14.             b = a
  15.             a = 19
  16.         EndIf
  17.     Next
  18.  
  19.     For b = b To 19
  20.         Poke.b (*dest + b),0
  21.     Next
  22.  
  23. End Statement
  24.  
  25. ;******************************************************************************************************************************
  26. ;Statement _arrtostr{*src}
  27. ;
  28. ;    SHARED the$
  29. ;    the$ = ""
  30. ;
  31. ;    For b.w = 0 To 18
  32. ;        If Peek.b(*src + b) = 0
  33. ;            b = 18
  34. ;        EndIf
  35. ;        the$ = the$ + Chr$(Peek.b(*src + b))
  36. ;    Next
  37. ;
  38. ;End Statement
  39. Statement _arrtostr{*src, l.w}
  40.     SHARED the$
  41.     the$ = ""
  42.     For b.w = 0 To l
  43.         If Peek.b(*src + b) = 0
  44.             b = l
  45.         EndIf
  46.         the$ = the$ + Chr$(Peek.b(*src + b))
  47.     Next
  48. End Statement
  49.  
  50. ;******************************************************************************************************************************
  51.  
  52. #SC_NAMELEN = 20
  53. #SC_TABLEN  = 5
  54. #SC_LEVELS  = 2
  55.  
  56. NEWTYPE .score              ; Score table entry type
  57.     level.l
  58.     name.b[#SC_NAMELEN]
  59. End NEWTYPE
  60.  
  61.  
  62. ;******************************************************************************************************************************
  63. ;File constants
  64. #SCR_FILE = 1
  65. #LOF_SCR  = (4 + #SC_NAMELEN) * (#SC_LEVELS + 1) * (#SC_TABLEN + 1)
  66.  
  67. scr_file$ = "sys:s/cca.league"
  68.  
  69. ;******************************************************************************************************************************
  70. ;Difficulty = array 1st dim
  71. #EASY   = 0
  72. #NORMAL = 1
  73. #TRICKY = 2
  74.  
  75. ;******************************************************************************************************************************
  76. ;Standard table holding area
  77. Dim table.score(#SC_LEVELS ,#SC_TABLEN)        ; Score table
  78.  
  79. ;******************************************************************************************************************************
  80.  
  81. ;Sort score. Note: last score must contain new score
  82. Function.b sortscr{lev.b}
  83.  
  84.     SHARED table()
  85.  
  86.     For pos.b = #SC_TABLEN To 1 Step -1
  87.         If table(lev,pos)\level > table(lev,pos-1)\level
  88.             Exchange table(lev,pos)\level,table(lev,pos-1)\level
  89.             For b.b = 0 To (#SC_NAMELEN -1)
  90.                 Exchange table(lev,pos)\name[b] ,table(lev,pos-1)\name[b]
  91.             Next b
  92.         Else
  93.             newscore.b = pos
  94.             pos = 0
  95.         EndIf
  96.     Next pos
  97.  
  98.     Function Return newscore.b
  99.  
  100. End Function
  101.